import config from '@/config'
import http from '@/utils/request.js'

export default {
    login: {
        name: '用户登录验证',
        url: `${import.meta.env.VITE_API_URL}/user/login`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },
    list: {
        name: '获取用户列表',
        url: `${import.meta.env.VITE_API_URL}/user/list`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },

    bind_user_role_list:{
        name: '获取关联的角色列表',
        url: `${import.meta.env.VITE_API_URL}/user/bind_user_role_list`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },

    add: {
        name: '添加用户',
        url: `${import.meta.env.VITE_API_URL}/user/add`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },
    update: {
        name: '更新用户',
        url: `${import.meta.env.VITE_API_URL}/user/update`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },

    delete: {
        name: '删除用户',
        url: `${import.meta.env.VITE_API_URL}/user/delete`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },

    details: {
        name: '用户详情',
        url: `${import.meta.env.VITE_API_URL}/user/details`,
        async post(data) {
            return await http.post(this.url, data)
        },
        async get(data) {
            return await http.get(this.url, data)
        }
    },

    export: {
        name: '导出用户列表',
        url: `${import.meta.env.VITE_API_URL}/user/export`,
        async get(data) {
            return await http.blob(this.url, data, { responseType: 'blob' })
        }
    },

    captcha: {
        name: '验证码',
        url: `${import.meta.env.VITE_API_URL}/user/captcha`,
        async get() {
            return await http.get(this.url)
        }
    }
}
